#include <memory_allocator.h>

std::unique_ptr<MemoryPoolImpl> MemoryAllocator::impl_ = nullptr;

MemoryChunk MemoryAllocator::allocate(std::size_t n)
{
    void *ptr = impl_->allocate(n);
    std::size_t size = impl_->ROUND_UP(n);
    MemoryChunk chunk{(char *)ptr, size};
    return chunk;   
}

void MemoryAllocator::deallocate(MemoryChunk &chunk)
{
    impl_->deallocate(chunk.data(), chunk.size());
}
